package com.itheima.mapper;

import com.github.pagehelper.Page;
import com.itheima.dto.LoginDto;
import com.itheima.dto.QueryEmpDto;
import com.itheima.pojo.Emp;
import com.itheima.vo.EmpVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmpMapper {

    Page<EmpVo> list(QueryEmpDto dto);


    void insert(Emp emp);

    @Select("select * from emp where id = #{id}")
    Emp getById(Integer id);


    void updateById(Emp emp);

    @Delete("delete from emp where  id= #{id}")
    void deleteByIds(Integer id);

    @Select("select * from emp")
    List<Emp> getAll();

    @Select("select * from emp where  username=#{username} and password=#{password}")
    Emp getByUserNameAndPassword(LoginDto dto);

    @Delete("delete from emp where dept_id = #{deptId}")
    void deleteByDeptId(Integer deptId);
}
